<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="/WEB-INF/common/common.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta charset="utf-8">
  <title>layui</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <link rel="stylesheet" href="<%=path %>/layui/css/layui.css">
  <link rel="stylesheet" href="<%=path %>/layui/css/lxq.css">
	<script type="text/javascript" src="<%=path %>/layui/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="<%=path %>/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="<%=path %>/layui/util.js" charset="utf-8"></script>
</head>
<body>
<div class="lxq-body">
	<div class="layui-row lxq-address">
		位置：数据管理>详情
		<hr>
	</div>


	
	 <form class="layui-form" action="<%=basePath %>/biz/Data_toDataList" method="post" id="searchForm">
	 <input type="hidden" name="id" value="${form.id }"/>
	<div class="layui-row lxq-search" >
		<div class="data-search">
			${search }
		  <button class="layui-btn" lay-submit lay-filter="search">搜索</button>
		  <button type="reset" class="layui-btn layui-btn-primary">重置</button>
		</div>
	</div>
</form>

 	<div class="layui-row lxq-form">
 	
 		<table id="dataTable" lay-filter="main">
		${json }
  <tbody>
 	<s:iterator value="dataList" >
 		<tr>
 			<td>${id }</td>
 			<s:iterator value="datas" var="d">
 				<td>${d }</td>
 			</s:iterator>
 		</tr>
 	</s:iterator>
  </tbody>
</table>
 	
 	</div>

</div>              
          

 
<script>
layui.use(['table','form'], function(){
  var table = layui.table;
  var form = layui.form;
  
  table.init('main', { //转化静态表格
      //height: 'full-500'
	  toolbar: 'true'
    }); 
  
  
  
  table.on('edit(main)', function(obj){
	  	var id = ${form.id};
	  	$.post('<%=basePath %>/biz/Data_edit',{json:JSON.stringify(obj.data),id:id},function(){});
	  });
  
	  //监听工具条
	  table.on('tool(main)', function(obj){
	    var data = obj.data;
		if(obj.event === 'del'){
	      layer.confirm('真的删除行么', function(index){
	        obj.del();
	        $.post('<%=basePath %>/biz/Data_del',{"id":data.id},function(){});
	        layer.close(index);
	      });
	    } 
	  });
  
	  form.on('submit(search)', function(data){
		  var datajson = JSON.stringify(data.field).toString();
		  
		  $.ajax({
				type:"post",
				url:"<%=basePath %>/biz/Data_searchData",
				data:{dataJson : datajson},
				success:function(dataList){

				}
		  });
		  
		  return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
		});
  

  
});
</script>



    <script type="text/html" id="barDemo">
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
	</script>

</body>
</html>